package com.itheima.demo08;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class Receive01 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10007);
        DatagramPacket dp = new DatagramPacket(new byte[1024],1024);
        ds.receive(dp);
        byte[] data = dp.getData();
        int length = data.length;
        System.out.println(new String(data,0,length));
        ds.close();
    }
}
